<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<script src="../static/angular.min.js"></script>
<head>
    <th:block th:include="include :: header('新增管理员')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<script>
    var app=angular.module("selectapp",[]);
    app.controller("selectcontroller",function ($scope,$http) {

    })
</script>
<body class="white-bg" ng-app="selectapp" ng-controller="selectcontroller">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-staff-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">角色名称：</label>
                <div class="col-sm-8">
                    <input name="staffName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">类型：</label>
                <div class="col-sm-8">
                    <select name="company"  class="form-control m-b">
                        <option value="" >所有</option>
                        
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否打开：</label>
                <div class="col-sm-8">
                    <input name="isOpen" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="staffMs" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">真实姓名：</label>
                <div class="col-sm-8">
                    <input name="realName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">登录姓名：</label>
                <div class="col-sm-8">
                    <input name="loginName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">登录密码：</label>
                <div class="col-sm-8">
                    <input name="loginPwd" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">手机号：</label>
                <div class="col-sm-8">
                    <input name="staffPhone" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">固定电话号：</label>
                <div class="col-sm-8">
                    <input name="fixPhone" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">权限开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="startTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">权限结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="endTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">部门</label>
                <select name="companyId" id="company">
                    <option value="">请选择</option>

                </select>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="">

    </script>
    <script type="text/javascript">
        var prefix = ctx + "system/staff"
        var prefixs = ctx + "system/dept"
        $("#form-staff-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-staff-add').serialize());
            }
        }

        $("input[name='startTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='endTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        /*$("#company").append({

            url: prefixs + "/list",

            type:"get",
            data:{},
            dateType:"json",

            success:function (data) {
                alert(JSON.stringify(data));
                for (var i = 0; i < data.length; i++) {
                    var option = document.createElement("option");
                    $(option).val(data[i].deptId);
                    $(option).text(data[i].deptName);
                    $('#company').append(option);
                }


            }
        });*/
        $(function(){
          $.ajax({
              url: prefixs + "/list",

              type:"get",
              data:{},
              dateType:"json",
              success:function (data) {
                  for (var i=0;i<data.length;i++) {
                      $("#company").append('<option value="+data[i].companyId+">"+data[i].companyName+"</option>');
                  }
              }
              }
          )
        })

    </script>
</body>
</html>